{{include file="public/header.php"/>}}

<ol class="breadcrumb">
	<li>
		<span class="glyphicon glyphicon-home"></span>
		<a href="{{U('Cms/Index/welcome')}}">首页</a>
	</li>
	<li>菜单列表</li>
</ol>
<div id="page-wrapper">
	<div class="row">
		<div class="col-lg-12">
			<div class="alert alert-success" style="border:solid 1px #27ae60;">
				<strong>注意!</strong>
				随意修改菜单将影响后台功能<br/>
				随意修改菜单将影响后台功能
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-lg-12">
			<div class="main-box clearfix">
				<div class="main-box-body clearfix">
					<div class="table-responsive">
						<table class="table table-striped table-hover">
							<thead>
								<tr>
									<th><span>排序</span></th>
									<th><span>id</span></th>
									<th><span>菜单名称</span></th>
									<th><span>状态</span></th>
									<th><span>系统</span></th>
									<th><span>操作</span></th>
								</tr>
							</thead>
							<tbody>
							{{foreach from="$menu" key="$k" value="$v"}}
									<tr>
										<td width="80">
											<input type="text" class="col-lg-12" name="sort" value="{{$v['sort']}}">
										</td>
										<td>{{$v['id']}}</td>
										<td>{{$v['_name']}}</td>
										<td>{{$v['show']?'显示':'关闭';}}</td>
										<td>{{$v['system']?'是':'否';}}</td>
										<td width="100">
											<div class="btn-group">
												<button type="button" class="btn btn-xs btn-default dropdown-toggle"
												data-toggle="dropdown">
												操作 <span class="caret"></span>
											</button>
											<ul class="dropdown-menu" role="menu">
												<li>
													<a href="/cms/menu/{{$v['id']}}/edit">
														<span class=" glyphicon glyphicon-edit"></span> 编辑
													</a>
												</li>
												<li>
													<a href="javascript:remove({{$v['id']}});">
														<span class="glyphicon glyphicon-trash"></span> 删除
													</a>
												</li>
											</ul>
										</div>
									</td>
								</tr>
							{{/foreach}}
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
</div>
</div>

{{include file="public/footer.php"/}}
<script>
	//删除菜单
	function remove(id) {
		if(confirm('确定删除吗'))
		{
			$.ajax({
				url: "/cms/menu/"+id,
				type: 'DELETE',
				dataType: 'JSON',
				success: function (result) {
					if (result.code == 0) {
						dialog(result.message, 'success', 1000, function () {
							window.location.reload(true);
						});
					}
					else {
						dialog(result.message, 'error', 1000);
					}
				}
			})
		}
	}
</script>